<?php
	$uid = $_GET["uid"];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>COWS | Administration</title>
        <link href="../css/user.css" media="screen" rel="stylesheet" type="text/css" />
        <style>
            body {
                background: #aecbdf url(../images/landing/subpage_bg.jpg) repeat-x left top
            }

            table.gray_table {
                background: #f7f7f7
            }

            table.gray_table td {
                border-top: 1px solid #fff;
                border-bottom: 1px solid #eee
            }
        </style>
        <script type="text/javascript" src="../js/jquery-1.6.1.js">
        </script>
        <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dojo/dojo.xd.js" type="text/javascript">
        </script>
    </head>
    <body>
        <div class="subpage_holder">
            <div class="container">
                <div class="span-5">
                    <a href="" class="logo"></a>
                </div>
                <div class="span-10">
                    <div id="top_nav">
                        <ul>
                            <li>
                                <a href="" class="active">Home</a>
                            </li>
                        </ul>
                    </div>
                </div>
                <div class="span-8 last margin_30">
                    <a href="../login.html" title="log in" class="log_in right"></a>
                    <a href="../registration.html" title="sign up" class="sign_up right"></a>
                </div>
                <div class="clear spacer">
                </div>
                <div class="subpage_content_outer left">
                    <div class="subpage_content_inner">
                        <div class="span-5 subpage_lcol">
                            <ul class="features_tabs">
                                <li>
                                    <a href="#tab1"><img src="../images/landing/icon_dash.png" align="absmiddle">Dashboard </a>
                                </li>
                                <li>
                                    <a href="#tab2"><img src="../images/landing/icon_dash.png" align="absmiddle">User Accounts </a>
                                </li>
                                <li>
                                    <a href="#tab3"><img src="../images/landing/icon_dash.png" align="absmiddle">Admin Accounts</a>
                                </li>
                                <li>
                                    <a href="#tab4"><img src="../images/landing/icon_rewards.png" align="absmiddle">Edit Rewards</a>
                                </li>
                                <li>
                                    <a href="#tab5"><img src="../images/landing/icon_edit.png" align="absmiddle">Edit Ads</a>
                                </li>
                                <li>
                                    <a href="#tab6"><img src="../images/landing/icon_analytics.png" align="absmiddle">Reports</a>
                                </li>
                            </ul>
                        </div>
                        <div class="span-17 last prepend-1">
                            <div class="tab_container">
                                <div id="tab1" class="tab_content">
                                    <div class="subpage_header">
                                        <span class="blue">Adminstrator Dashboard</span>
                                    </div>
                                    <hr/>
                                    <div class="span-8 feature_box">
                                        <h5><a href="<?php echo "./profile.php?uid=$uid&tab=1" ?>">User Accounts</a></h5>
                                        <p>
                                            Edit current user account information including changing passwords, adding/removing time, and adding/removing reward points.
                                        </p>
                                    </div>
                                    <div class="span-6">
                                    </div>
                                    <hr/>
                                    <div class="span-8 feature_box">
                                        <h5><a href="<?php echo "./profile.php?uid=$uid&tab=2" ?>">Admin Accounts</a></h5>
                                        <p>
                                            Create and edit administrator accounts.
                                        </p>
                                    </div>
                                    <div class="span-6">
                                    </div>
                                    <hr/>
                                    <div class="span-8 feature_box">
                                        <h5><a href="<?php echo "./profile.php?uid=$uid&tab=3" ?>">Edit Rewards</a></h5>
                                        <p>
                                            Modify the currently available rewards.
                                        </p>
                                    </div>
                                    <div class="span-6">
                                    </div>
                                    <hr/>
                                    <div class="span-8 feature_box">
                                        <h5><a href="<?php echo "./profile.php?uid=$uid&tab=4" ?>">Edit Ads</a></h5>
                                        <p>
                                            Modify the advertisements displayed to users.
                                        </p>
                                    </div>
                                    <div class="span-6">
                                    </div>
                                    <hr/>
                                    <div class="span-8 feature_box">
                                        <h5><a href="<?php echo "./profile.php?uid=$uid&tab=5" ?>">Reports</a></h5>
                                        <p>
                                            View statistics on system usage.
                                        </p>
                                    </div>
                                    <div class="span-6">
                                    </div>
                                    <hr/>
                                </div>
                                <div id="tab2" class="tab_content">
                                    <div class="subpage_header">
                                        <span class="blue">User Accounts</span>
                                    </div>
                                    <hr/>
                                    <div>
                                        <h5>Search by Username</h5>
                                        <form action="<?php echo "./finduser.php?uid=$uid" ?>" method="post">
                                        <table name="tblCreateAcct" id="tblCreateAcct" cellspacing="0" cellpadding="10" border="0" width="100%" class="gray_table left">
                                            <tr>
                                                <td align="right" height="60" valign="middle" width="200">
                                                    <label>
                                                        Username/Email:
                                                    </label>
                                                </td>
                                                <td valign="middle">
                                                    <input class="text_box" type="text" name="uname" id="uname" value="" /> *
                                                </td>
                                                <td align="left" valign="middle">
                                                    <div class="td_spacer">
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" valign="middle">
                                                </td>
                                                <td valign="middle">
                                                    <input name="submit" type="submit" value="Submit" />
                                                </td>
                                                <td align="left" valign="middle">
                                                    <div class="td_spacer">
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                      </form><br/><br/><br/><br/>
									 
									  <?php
										$sid = $_GET["sid"];
										$updated = $_GET["updated"];

										$host="db.seng.uvic.ca"; // Host name
										$username="se321g01"; // Mysql username
										$password="un8bi2YM"; // Mysql password
										$db_name="se321g01"; // Database name
										$tbl_name="user_info"; // Table name

										// Connect to server and select databse.
										mysql_connect("$host", "$username", "$password")or die("cannot connect");
										mysql_select_db("$db_name")or die("cannot select DB");
										
										$result = mysql_query("SELECT * FROM user_info WHERE uid='$sid'");

										$row = mysql_fetch_array($result);
										$ua_firstname = $row['first_name'];
										$ua_lastname = $row['last_name'];
										$ua_email = $row['email'];
										$result = mysql_query("SELECT * FROM user_stats WHERE uid='$sid'");
										$row = mysql_fetch_array($result);
										$ua_remainingtime = $row['time_left'];
										$ua_points = $row['points'];
  									  ?>
									  <?php if(!($sid == "")) echo("
                                      <h5>Now Editing ". $ua_email . "'s Profile</h5>
                                      <form action=\"./edit.php?uid=". $uid ."&sid=". $sid . "\" method=\"post\">
                                        <table name=\"tblCreateAcct\" id=\"tblCreateAcct\" cellspacing=\"0\" cellpadding=\"10\" border=\"0\" width=\"100%\" class=\"gray_table left\">
                                            <tr>
                                                <td align=\"right\" height=\"60\" valign=\"middle\" width=\"200\">
                                                    <label>
                                                        First Name:
                                                    </label>
                                                </td>
                                                <td valign=\"middle\">
                                                    <input class=\"text_box\" type=\"text\" name=\"ua_firstname\" id=\"ua_firstname\" value=\"". $ua_firstname ."\" /> *
                                                </td>
                                                <td align=\"left\" valign=\"middle\">
                                                    <div class=\"td_spacer\">
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align=\"right\" height=\"60\" valign=\"middle\">
                                                    <label>
                                                        Last Name:
                                                    </label>
                                                </td>
                                                <td valign=\"middle\">
                                                    <input class=\"text_box\" type=\"text\" name=\"ua_lastname\" id=\"ua_lastname\" value=\"". $ua_lastname ."\" /> *
                                                </td>
                                                <td align=\"left\" valign=\"middle\">
                                                    <div class=\"td_spacer\">
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align=\"right\" height=\"60\" valign=\"middle\">
                                                    <label>
                                                    	Password:
                                                    </label>
                                                </td>
                                                <td valign=\"middle\">
                                                    <input class=\"text_box\" type=\"text\" name=\"ua_password\" id=\"ua_password\" value=\"\" /> *
                                                </td>
                                                <td align=\"left\" valign=\"middle\">
                                                    <div class=\"td_spacer\">
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align=\"right\" height=\"60\" valign=\"middle\">
                                                    <label>
                                                        Remaining Time:
                                                    </label>
                                                </td>
                                                <td valign=\"middle\">
                                                    <input class=\"text_box\" type=\"text\" name=\"ua_remainingtime\" id=\"ua_remainingtime\" value=\"". $ua_remainingtime ."\" /> *
                                                </td>
                                                <td align=\"left\" valign=\"middle\">
                                                    <div class=\"td_spacer\">
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align=\"right\" height=\"60\" valign=\"middle\">
                                                    <label>
                                                        Reward Points:
                                                    </label>
                                                </td>
                                                <td valign=\"middle\">
                                                    <input class=\"text_box\" type=\"text\" name=\"ua_points\" id=\"ua_points\" value=\"". $ua_points ."\" /> *
                                                </td>
                                                <td align=\"left\" valign=\"middle\">
                                                    <div class=\"td_spacer\">
                                                    </div>
                                                </td>
                                            </tr>

                                            <tr>
                                                <td align=\"right\" valign=\"middle\">
                                                </td>
                                                <td valign=\"middle\">
                                                    <input name=\"submit\" type=\"submit\" value=\"Modify Account\" />
                                                </td>
                                                <td align=\"left\" valign=\"middle\">
                                                    <div class=\"td_spacer\">
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                      </form>
									  ");
									  ?>
                                    </div>

                                </div>
                                <div id="tab3" class="tab_content">
                                    <div class="subpage_header">
                                        <span class="blue">Admin Accounts</span>
                                    </div>
                                    <hr/>
                         <div>
									   <h5>Search by Username</h5>
                                        <form action="<?php echo "./findadmin.php?uid=$uid" ?>" method="post">
                                        <table name="tblCreateAcct" id="tblCreateAcct" cellspacing="0" cellpadding="10" border="0" width="100%" class="gray_table left">
                                            <tr>
                                                <td align="right" height="60" valign="middle" width="200">
                                                    <label>
                                                        Username/Email:
                                                    </label>
                                                </td>
                                                <td valign="middle">
                                                    <input class="text_box" type="text" name="uname" id="uname" value="" /> *
                                                </td>
                                                <td align="left" valign="middle">
                                                    <div class="td_spacer">
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" valign="middle">
                                                </td>
                                                <td valign="middle">
                                                    <input name="submit" type="submit" value="Submit" />
                                                </td>
                                                <td align="left" valign="middle">
                                                    <div class="td_spacer">
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                      </form><br/><br/><br/><br/>
									 
									  <?php
										$aid = $_GET["aid"];
										$updated = $_GET["updated"];

										$host="db.seng.uvic.ca"; // Host name
										$username="se321g01"; // Mysql username
										$password="un8bi2YM"; // Mysql password
										$db_name="se321g01"; // Database name
										$tbl_name="user_info"; // Table name

										// Connect to server and select databse.
										mysql_connect("$host", "$username", "$password")or die("cannot connect");
										mysql_select_db("$db_name")or die("cannot select DB");
										
										$result = mysql_query("SELECT * FROM user_info WHERE uid='$aid'");

										$row = mysql_fetch_array($result);
										$ua_firstname = $row['first_name'];
										$ua_lastname = $row['last_name'];
										$ua_email = $row['email'];
  									  ?>
									  <?php if(!($aid == "")) echo("
                                      <h5>Now Editing ". $ua_email . "'s Profile</h5>
                                      <form action=\"./editadmin.php?uid=". $uid ."&aid=". $aid . "\" method=\"post\">
                                        <table name=\"tblCreateAcct\" id=\"tblCreateAcct\" cellspacing=\"0\" cellpadding=\"10\" border=\"0\" width=\"100%\" class=\"gray_table left\">
                                            <tr>
                                                <td align=\"right\" height=\"60\" valign=\"middle\" width=\"200\">
                                                    <label>
                                                        First Name:
                                                    </label>
                                                </td>
                                                <td valign=\"middle\">
                                                    <input class=\"text_box\" type=\"text\" name=\"ua_firstname\" id=\"ua_firstname\" value=\"". $ua_firstname ."\" /> *
                                                </td>
                                                <td align=\"left\" valign=\"middle\">
                                                    <div class=\"td_spacer\">
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align=\"right\" height=\"60\" valign=\"middle\">
                                                    <label>
                                                        Last Name:
                                                    </label>
                                                </td>
                                                <td valign=\"middle\">
                                                    <input class=\"text_box\" type=\"text\" name=\"ua_lastname\" id=\"ua_lastname\" value=\"". $ua_lastname ."\" /> *
                                                </td>
                                                <td align=\"left\" valign=\"middle\">
                                                    <div class=\"td_spacer\">
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align=\"right\" height=\"60\" valign=\"middle\">
                                                    <label>
                                                    	Password:
                                                    </label>
                                                </td>
                                                <td valign=\"middle\">
                                                    <input class=\"text_box\" type=\"text\" name=\"ua_password\" id=\"ua_password\" value=\"\" /> *
                                                </td>
                                                <td align=\"left\" valign=\"middle\">
                                                    <div class=\"td_spacer\">
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align=\"right\" valign=\"middle\">
                                                </td>
                                                <td valign=\"middle\">
                                                    <input name=\"submit\" type=\"submit\" value=\"Modify Account\" />
                                                </td>
                                                <td align=\"left\" valign=\"middle\">
                                                    <div class=\"td_spacer\">
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                      </form>
									  ");
									  ?>
                                    <br/><br/><br/><br/>
									<h5>Create New Admin Account</h5>
                                      <form action="<?php echo "./createadmin.php?uid=$uid" ?>" method="post">
                                        <table name="tblCreateAcct" id="tblCreateAcct" cellspacing="0" cellpadding="10" border="0" width="100%" class="gray_table left">
                                            <tr>
                                                <td align="right" height="60" valign="middle" width="200">
                                                    <label>
                                                        First Name:
                                                    </label>
                                                </td>
                                                <td valign="middle">
                                                    <input class="text_box" type="text" name="ca_firstname" id="ca_firstname" value="" /> 
                                                *</td>
                                                <td align="left" valign="middle">
                                                    <div class="td_spacer">
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" height="60" valign="middle">
                                                    <label>
                                                        Last Name:
                                                    </label>
                                                </td>
                                                <td valign="middle">
                                                    <input class="text_box" type="text" name="ca_lastname" id="ca_lastname" value="" /> 
                                                    *
                                                </td>
                                                <td align="left" valign="middle">
                                                    <div class="td_spacer">
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" height="60" valign="middle">
                                                    <label>
                                                    	Username/Email:
                                                    </label>
                                                </td>
                                                <td valign="middle">
                                                    <input class="text_box" type="text" name="ca_email" id="ca_email" value="" /> 
                                                    *
                                                </td>
                                                <td align="left" valign="middle">
                                                    <div class="td_spacer">
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" height="60" valign="middle">
                                                    <label>
                                                        Password:
                                                    </label>
                                                </td>
                                                <td valign="middle">
                                                    <input class="text_box" type="text" name="ca_password" id="ca_password" value="" /> 
                                                    *
                                                </td>
                                                <td align="left" valign="middle">
                                                    <div class="td_spacer">
                                                    </div>
                                                </td>
                                            </tr>

                                            <tr>
                                                <td align="right" valign="middle">
                                                </td>
                                                <td valign="middle">
                                                    <input name="submit" type="submit" value="Create Account" />
                                                </td>
                                                <td align="left" valign="middle">
                                                    <div class="td_spacer">
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                </form>
                                  </div>
                                </div>
                                <div id="tab4" class="tab_content">
                                    <div class="subpage_header">
                                        <span class="blue">Rewards</span>
                                    </div>
                                    <hr/>
                                    <div>
                                      <h5>Add New Reward</h5>
                                      <form action=<?php echo "./addreward.php?uid=$uid"; ?> method="post" enctype="multipart/form-data">
                                        <table name="tblCreateAcct" id="tblCreateAcct" cellspacing="0" cellpadding="10" border="0" width="100%" class="gray_table left">
                                            <tr>
                                                <td align="right" height="60" valign="middle" width="200">
                                                    <label>
                                                        Title:
                                                    </label>
                                                </td>
                                                <td valign="middle">
                                                    <input class="text_box" type="text" name="title" id="title" value="" /> 
                                                *</td>
                                                <td align="left" valign="middle">
                                                    <div class="td_spacer">
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" height="60" valign="middle" width="200">
                                                    <label>
                                                        Description:
                                                    </label>
                                                </td>
                                                <td valign="middle">
                                                    <input class="text_box" type="text" name="description" id="description" value="" /> 
                                                *</td>
                                                <td align="left" valign="middle">
                                                    <div class="td_spacer">
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" height="60" valign="middle">
                                                    <label>
                                                        Cost:
                                                    </label>
                                                </td>
                                                <td valign="middle">
                                                    <input class="text_box" type="text" name="cost" id="cost" value="" /> 
                                                    *
                                                </td>
                                                <td align="left" valign="middle">
                                                    <div class="td_spacer">
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" height="60" valign="middle">
                                                    <label>
                                                        Image:
                                                    </label>
                                                </td>
                                                <td valign="middle">
                                                    <input name="filepicker" type="file" value="Browse" /> 
                                                    *</td>
                                                <td align="left" valign="middle">
                                                    <div class="td_spacer">
                                                    </div>
                                                </td>
                                            </tr>

                                            <tr>
                                                <td align="right" valign="middle">
                                                </td>
                                                <td valign="middle">
                                                    <input type="submit" value="Add Reward" />
                                              </td>
                                                <td align="left" valign="middle">
                                                    <div class="td_spacer">
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                	</form>
                                    <br /><br />
                                    <h5>Existing Rewards</h5>
                                    		
                                      <form action=<?php echo "./deletereward.php?uid=$uid"; ?> method="post">
                                        <table name="tblCreateAcct" id="tblCreateAcct" cellspacing="0" cellpadding="10" border="0" width="100%" class="gray_table left">
                                            <tr>
                                                <td align="right" height="60" valign="middle" width="200">
                                                    <label>
                                                        Reward Title:
                                                    </label>
                                                </td>
                                                <td valign="middle">
                                                    <select name="rewards">
                                                    	<?php
                                                    	$host="db.seng.uvic.ca"; // Host name
														$username="se321g01"; // Mysql username
														$password="un8bi2YM"; // Mysql password
														$db_name="se321g01"; // Database name
														$tbl_name="user_info"; // Table name
				
														// Connect to server and select databse.
														mysql_connect("$host", "$username", "$password")or die("cannot connect");
														mysql_select_db("$db_name")or die("cannot select DB");
														
                                                    	$sql="SELECT * FROM rewards";
														$result=mysql_query($sql);
														
														while($row = mysql_fetch_array($result))
														{
															echo "<option value=" . $row['title'] . ">" . $row['title'] . "</option>";
														}
                                                    	?>
                                                    </select>
                                                *</td>
                                                <td align="left" valign="middle">
                                                    <div class="td_spacer">
                                                    </div>
                                                </td>
                                            </tr>
											<tr>
                                                <td align="right" height="60" valign="middle">
                                                  <label>
                                                        Delete:
                                                    </label>
                                                </td>
                                                <td valign="middle"><input name="delete" type="checkbox" value="" /></td>
                                                <td align="left" valign="middle">
                                                    <div class="td_spacer">
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" valign="middle">
                                                </td>
                                                <td valign="middle">
                                                    <input name="submit" type="submit" value="Delete Reward" />
                                            </td>
                                                <td align="left" valign="middle">
                                                    <div class="td_spacer">
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                	</form>
                                    </div>
                                </div>
                                <div id="tab5" class="tab_content">
                                    <div class="subpage_header">
                                        <span class="blue">Advertisements</span>
                                    </div>
                                    <hr/>
<div>
                                        <h5>Add New Advertisement</h5>
                                      <form enctype="multipart/form-data" action="<?php echo "./newad.php?uid=$uid"; ?>" method="post">
                                        <table name="tblCreateAcct" id="tblCreateAcct" cellspacing="0" cellpadding="10" border="0" width="100%" class="gray_table left">
                                            <tr>
                                                <td align="right" height="60" valign="middle" width="200">
                                                    <label>
                                                        Link:
                                                    </label>
                                                </td>
                                                <td valign="middle">
                                                    <input class="text_box" type="text" name="thelink" id="thelink" value="" /> 
                                                *</td>
                                                <td align="left" valign="middle">
                                                    <div class="td_spacer">
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right" height="60" valign="middle"><label>
                                                    Image:
                                                </label>
                                                </td>
                                                <td valign="middle">
													<input type="hidden" name="MAX_FILE_SIZE" value="512000" />
                                                    <input class="text_box" type="file" name="uploadedfile" id="uploadedfile" value="" />
                                                    *</td>
                                                <td align="left" valign="middle">
                                                    <div class="td_spacer">
                                                    </div>
                                                </td>
                                            </tr>

                                            <tr>
                                                <td align="right" valign="middle">
                                                </td>
                                                <td valign="middle">
                                                    <input name="submit" type="submit" value="Add Advertisement" />
                                              </td>
                                                <td align="left" valign="middle">
                                                    <div class="td_spacer">
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                       	</form>
                                    <br /><br />
                            <h5>Existing Advertisements</h5>
                                      <form action="<?php echo "./modad.php?uid=$uid"; ?>" method="post">
                                        <table name="tblCreateAcct" id="tblCreateAcct" cellspacing="0" cellpadding="10" border="0" width="100%" class="gray_table left">
											<?php
												$host="db.seng.uvic.ca"; // Host name
												$username="se321g01"; // Mysql username
												$password="un8bi2YM"; // Mysql password
												$db_name="se321g01"; // Database name
												$tbl_name="user_info"; // Table name
		
												// Connect to server and select databse.
												mysql_connect("$host", "$username", "$password")or die("cannot connect");
												mysql_select_db("$db_name")or die("cannot select DB");
												
												$sql="SELECT * FROM ads_info";
												$result=mysql_query($sql);
												$i = 0;
												while($row = mysql_fetch_array($result))
												{
													$linktext = "link" .$i;
													$del = "del" .$i;
													echo ("<tr>
                                                <td align=\"right\" height=\"60\" valign=\"middle\" width=\"200\">
                                                    <label>
                                                        Link:
                                                    </label>
                                                </td>
                                                <td valign=\"middle\">
                                                    <input class=\"text_box\" type=\"text\" name=\"". $linktext ."\" id=\"". $linktext ."\" value=\"". $row['link'] ."\" /> 
                                                    *</td>
                                                <td align=\"left\" valign=\"middle\">
                                                    <div class=\"td_spacer\">
                                                    </div>
                                                </td>
                                            </tr>
											<tr>
                                                <td align=\"right\" height=\"60\" valign=\"middle\">
                                                    <label>
                                                        Image:
                                                    </label>
                                                </td>
                                                
                                                <td align=\"left\" valign=\"middle\">
                                                    <img src=\"". $row['file'] ."\" width=\"300\" height=\"50\"/>
													<div class=\"td_spacer\">
                                                    </div>
                                                </td>
                                            </tr>
											<tr>
                                                <td align=\"right\" height=\"60\" valign=\"middle\">
                                                  <label>
                                                        Delete:
                                                  </label>
                                                </td>
                                                <td valign=\"middle\"><input name=\"". $del ."\" type=\"checkbox\" value=\"\" /></td>
                                                <td align=\"left\" valign=\"middle\">
                                                    <div class=\"td_spacer\">
                                                    </div>
                                                </td>
                                            </tr>
											");
												$i++;
												}
                                            ?>
                                            <tr>
                                                <td align="right" valign="middle">
                                                </td>
                                                <td valign="middle">
                                                    <input name="submit" type="submit" value="Modify Advertisement(s)" />
                                            </td>
                                                <td align="left" valign="middle">
                                                    <div class="td_spacer">
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
</form>
                                    </div>
                                </div>
                                <div id="tab6" class="tab_content">
                                    <div class="subpage_header">
                                        <span class="blue">Reports</span>
                                    </div>
                                    <hr/>
                                    <div>
                                        <h5>Bandwidth Usage</h5>
                                      <div id="chart1" style="width:400px;height:300px;"></div>
										<script>
                                            dojo.require('dojox.charting.Chart2D');
                                            dojo.require('dojox.charting.widget.Chart2D');
                                            dojo.require('dojox.charting.themes.PlotKit.blue');
                                        
                                            /* JSON information */
                                            var json = {
                                                January: [12999,14487,19803,15965,17290],
                                                February: [14487,12999,15965,17290,19803],
                                                March: [15965,17290,19803,12999,14487]
                                            };
                                        
                                            /* build pie chart data */
                                            var chartData = [];
                                            dojo.forEach(json['January'],function(item,i) {
                                                chartData.push({ x: i, y: json['January'][i] });
                                            });
                                        
                                            /* resources are ready... */
                                            dojo.ready(function() {
                                        
                                                //create / swap data
                                                var barData = [];
                                                dojo.forEach(chartData,function(item) { barData.push({ x: item['y'], y: item['x'] }); });
                                                var chart1 = new dojox.charting.Chart2D('chart1').
                                                                setTheme(dojox.charting.themes.PlotKit.blue).
                                                                addAxis('x', { fixUpper: 'major', includeZero: false, min:0, max:6 }).
                                                                addAxis('y', { vertical: true, fixLower: 'major', fixUpper: 'major' }).
                                                                addPlot('default', {type: 'Columns', gap:5 }).
                                                                addSeries('Visits For February', chartData, {});
                                                var anim4c = new dojox.charting.action2d.Shake(chart1,'default');
                                                chart1.render();
                                                var legend4 = new dojox.charting.widget.Legend({ chart: chart1 }, 'legend3');
                                        
                                            });
                                        </script>

                                        <h5>Peak Times</h5>
                                        <div id="chart2" style="width:400px;height:300px;"></div>
<script>
    dojo.require('dojox.charting.Chart2D');
    dojo.require('dojox.charting.widget.Chart2D');
    dojo.require('dojox.charting.themes.Tom');

    /* JSON information */
    var json = {
        January: [12999,14487,19803,15965,17290],
        February: [14487,12999,15965,17290,19803],
        March: [15965,17290,19803,12999,14487]
    };

    /* build pie chart data */
    var chartData = [];
    dojo.forEach(json['January'],function(item,i) {
        chartData.push({ x: i, y: json['January'][i] });
    });

    /* resources are ready... */
    dojo.ready(function() {

        var chart2 = new dojox.charting.Chart2D('chart2').
                        setTheme(dojox.charting.themes.Tom).
                        addPlot('default', {type: 'Pie', radius: 70, fontColor: 'black'}).
                        addSeries('Visits', chartData).
                        render();
        var anim = new dojox.charting.action2d.MoveSlice(chart2, 'default');
        chart2.render();

    });
</script>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="clear spacer">
                </div>
                <div class="subpage_footer left">
                </div>
                <div class="spacer20 clear">
                </div>
                <div class="span-24 last blue_box2">
                </div>
            </div>
        </div>
        <div class="spacer20 clear">
        </div>
        <div class="footer_landing">
            <div class="container">

                <div id="landing_footer_head_contact" class="span-8">
                    <div class="landing_footer_head">
                        Contact
                    </div>
                    Please call our support number at 1-800-555-5555 for any technical support questions.
                </div>
                <div class="span-8 last">
                    <div class="landing_footer_head">
                        Company
                    </div>
                    COWS is a product owned by WiFi Rewards, and was purchased from Steakhouse Communications.
                    <br/>
                    <br/>
                </div>
                <div style="border-top: 1px solid #1a1a1a; border-bottom: 1px solid #555555; margin: 0px 0 10px 0" class="clear">
                </div>
                <div class="left">
                    <div class="span-4">
                        &copy; 2011 Steakhouse Communications
                    </div>
                    <div class="span-8" id="footer_nav">
                        <ul>
                            <li>
                                <a href="../login.html">Login</a>
                            </li>
                            <li>
                                <a href="../registration.html">Registration</a>
                            </li>
                            <li>
                                <a href="">Legal</a>
                            </li>
                            <li>
                                <a href="">Links</a>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </body>
    <script>
        $(document).ready(function(){
            $("ol ol").css("list-style", "lower-alpha");
            $("ol ol ol").css("list-style", "lower-roman");
            var currentSlide = 1;
            $(function(){
                var $page = document.location.href;
                $('#top_nav li a').each(function(){
                    var $href = $(this).attr('href');
                    if (($page.indexOf($href) != -1) || ($href == '')) {
                        $(this).addClass('active');
                    }
                    else {
                        $(this).removeClass('active');
                    }
                });
            });
            $(".tab_content").hide();
            $("ul.features_tabs li:eq("+<?php echo $_GET['tab']; ?>+")").addClass("active").show();
            $(".tab_content:eq("+<?php echo $_GET['tab']; ?>+")").show();
            $("ul.features_tabs li").click(function(){
                $("ul.features_tabs li").removeClass("active");
                $(this).addClass("active");
                $(".tab_content").hide();
                var activeTab = $(this).find("a").attr("href");
                $(activeTab).fadeIn();
                return false;
            });
        });
    </script>
</html>
